package com.tengju.motivation.domain.model.activity;

import lombok.AllArgsConstructor;

/**
 * @author: 李大仙
 * @date: 2021/12/27 12:30 下午
 */
@AllArgsConstructor
public enum ActivityType {

    SALE(10, "销售活动"),
    GROWTH(20, "用户增长活动"),
    ;

    private final Integer val;
    private final String desc;

    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static ActivityType fromVal(Integer val) {
        for (ActivityType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }

    public static ActivityType fromName(String name) {
        for (ActivityType type : values()) {
            if (type.name().equals(name)) {
                return type;
            }
        }
        return null;
    }

}
